//
//  BaseNavController.m
//  OPEN
//
//  Created by 净邻 on 2016/10/20.
//  Copyright © 2016年 净邻. All rights reserved.
//

#import "BaseNavController.h"

@interface BaseNavController ()<UINavigationControllerDelegate>

@end

@implementation BaseNavController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.delegate = self;
    [self setWithOutAnimation];

}

-(void)setWithOutAnimation{
    //    _alphaView.alpha = 0;
    UIImage *image = [[UIImage alloc] init];
    //设置导航栏背景图片为一个空的image，这样就透明了
    [self.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
    //去掉透明后导航栏下边的黑边
    [self.navigationBar setUserInteractionEnabled:YES];
    [self.navigationBar setShadowImage:image];
    //    self.navigationBar.barStyle = UIBarStyleBlack;
    self.navigationBar.translucent = YES;
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    if (self.viewControllers.count > 0) {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    [super pushViewController:viewController animated:animated];
}

#pragma mark - UINavigationControllerDelegate Methods -

- (void)navigationController:(UINavigationController *)navigationController
      willShowViewController:(UIViewController *)viewController
                    animated:(BOOL)animated
{
    
    if ([navigationController isEqual:self] && [viewController isEqual:[self.viewControllers firstObject]]) {
        [self setNavigationBarHidden:YES animated:animated];
    } else {
        [self setNavigationBarHidden:NO animated:animated];
        
    }
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

@end
